define(function (require, exports, module) {
    var myPub = require('./public');
    var payPub = require('./submit_pay');

    var oWrap = $('.js_wrap');
    var $submitBtn = $(".js_btnPay");           // 提交支付按钮
    var lazLoading = new myPub.lazLoadingImg();

    var oMyPayType = $('.js_myPayType');    // 支付方式选择
    var oShowNum = $('.js_showNum');                // 显示手机号码眼睛
    var oPhoneNum = $('.js_phoneNum');              // 全部手机号码
    var oHidePhoneNUm = $('.js_hidePhoneNUm');      // 隐藏手机号码
    var nPhoneNum = oPhoneNum.text();
    var nHideNum = nPhoneNum.substr(0,3)+'****'+nPhoneNum.substr(7,11);

    module.exports = {
        init: function(data,names){
            lazLoading.AddLazLoadingImg(oWrap[0]);
            payType.choosePayType();
            //积分不够如果不能购买，那么弹出提示框
            if(isJifen==true&&canBuy == false&&pointCost!=null&&pointCost!=undefined&&pointCost!=""){
                myPub.TipLayerLong("抱歉，该商品兑换须"+pointCost+"积分，您的积分暂未达到兑换条件，请继续努力哦！~");
            }
        }
    };
// 手机号码隐藏
    oHidePhoneNUm.text(nHideNum);
    oShowNum.hammer().on('tap',function () {
        if($(this).hasClass('on')){
            oPhoneNum.hide();
            oHidePhoneNUm.show();
            $(this).removeClass('on icon-eye_look').addClass('icon-eye_close')
        }else{
            oHidePhoneNUm.hide();
            oPhoneNum.show();
            $(this).addClass('on icon-eye_look').removeClass('icon-eye_close')
        }
    });

    var payType = {
        choosePayType : function () {
            oMyPayType.find('.js_checkBox').removeClass('active').eq(0).addClass('active');
        },
    };

    //提交订单按钮单击事件
    $submitBtn.click(function(){
        var payUrl = "/shop/payment/continuePay";
        var paymentId = $submitBtn.attr('data-paymentId');
        var data = {paymentId:paymentId};
        payPub.submitPay(payUrl,data);
    });

})